package com.greatwqs.wmall.product.provider.service.impl;

import com.greatwqs.wmall.common.module.util.JsonUtil;
import com.greatwqs.wmall.product.provider.manager.ProductManager;
import com.greatwqs.wmall.product.provider.model.vo.ProductInfoVo;
import com.greatwqs.wmall.product.provider.service.ProductService;

import lombok.extern.slf4j.Slf4j;

import org.apache.skywalking.apm.toolkit.trace.TraceContext;
import org.modelmapper.ModelMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @author wang-qingsong
 */
@Slf4j
@Service
public class ProductServiceImpl implements ProductService {

    @Autowired
    private ModelMapper modelMapper;

    @Autowired
    private ProductManager productManager;

    @Override
    public ProductInfoVo getProductInfo(Long productId) {
        log.info("getProductInfo productId: {}", productId);
        return modelMapper.map(productManager.getProductByIdNotNull(productId), ProductInfoVo.class);
    }
}
